﻿@model NewsPublish.Model.Response.ResponseModel
@{
    Layout = null;
}

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/admmin/js/html5.js"></script>
    <script type="text/javascript" src="/admmin/js/respond.min.js"></script>
    <script type="text/javascript" src="/admmin/js/PIE_IE678.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="/admin/css/H-ui.css" />
    <link type="text/css" rel="stylesheet" href="/admin/css/H-ui.admin.css" />
    <link type="text/css" rel="stylesheet" href="/admin/font/font-awesome.min.css" />
    <link href="~/Editor/wangEditor.min.css" rel="stylesheet" />
    <!--[if IE 7]>
    <link href="/admmin/font/font-awesome-ie7.min.css" rel="stylesheet" type="text/css" />
    <![endif]-->
    <title>添加新闻</title>

</head>
<body>
    <div class="pd-20">
        <div class="Huiform">
            <form action="/" method="post" enctype="multipart/form-data" id="addForm">
                <table class="table table-bg">
                    <tbody>
                        <tr>
                            <th width="300" class="text-r"><span class="c-red">*</span> 新闻标题：</th>
                            <td>
                                <input type="text" style="width:300px" class="input-text" value="" placeholder="" id="Title" name="Title" datatype="*2-16" nullmsg="新闻标题不能为空">
                            </td>
                        </tr>
                        <tr>
                            <th class="text-r"><span class="c-red">*</span> 新闻类别：</th>
                            <td>
                                <select class="select" id="NewsClassifyId" name="NewsClassifyId">
                                    @if (Model.code == 200)
                                    {
                                        @foreach (var classify in Model.data)
                                        {
                                            <option value="@classify.Id">@classify.Name</option>
                                        }
                                    }

                                </select>
                            </td>
                        </tr>
                        <tr>
                            <th class="text-r">新闻图片：</th>
                            <td><input type="file" class="" name="img" multiple datatype="*2-120" nullmsg="新闻图片不能为空"></td>
                        </tr>
                        <tr>
                            <th class="text-r">新闻内容：</th>
                            <td> <div id="div1" name="div1"></div></td>
                        </tr>
                        <tr>
                            <th></th>
                            <td>
                                <textarea name="ContentsHtml" id="ContentsHtml" hidden="hidden"></textarea>
                                <textarea name="Contents" id="Contents" hidden="hidden"></textarea>
                            </td>
                        </tr>
                        <tr>
                            <th class="text-r">备注：</th>
                            <td><textarea class="input-text" name="Remark" id="Remark" style="height:50px;width:350px;"></textarea></td>
                        </tr>
                        <tr>
                            <th></th>
                            <td><button class="btn btn-success radius" type="button" onclick="add()"><i class="icon-ok"></i> 确定</button></td>
                        </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
    <script type="text/javascript" src="/admin/js/jquery.min.js"></script>
    <script type="text/javascript" src="/admin/js/Validform_v5.3.2_min.js"></script>
    <script type="text/javascript" src="/admin/js/H-ui.js"></script>
    <script type="text/javascript" src="/admin/js/H-ui.admin.js"></script>

    @*<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>*@
    <script type="text/javascript" src="~/Editor/wangEditor.min.js"></script>

    <script src="~/Editor/IEditor.js"></script>
    @*<script src="~/js/xss.js"></script>*@


    <script type="text/javascript">

        function add() {
            var formData = new FormData(document.getElementById("addForm"));
            $.ajax({
                type: 'post',
                async: false,
                cache: false,
                contentType: false,
                processData: false,
                url: '/Admin/News/AddNews',
                data: formData,
                success: function (data) {
                    if (data.code == 200) {
                        parent.reload();
                    } else {
                        alert(data.result);
                    }
                }
            })
        }
    </script>


</body>
</html>